{% extends "layout/normal/layout.twig" %}
{% block body %}
    <div class="contentBox">
        <b><my:a href="{{ url_base }}index.php?go={{ appName }}.auth.logout">退出</my:a></b><br/><br/>
        <b>共计{{ countBlogs }} 篇博客</b>
        {% if blogs %}
        {% for blog in blogs %}
        <div id='blog{{ blog.blog_id }}' class="block">
            <b><my:a href="{{ url_base }}index.php?go={{ appName }}.comment.comment&blog_id={{ blog.blog_id }}&pageNo={{ app.request.get('pageNo')|default('1') }}">{{ blog.blog_name }}</my:a>
            {% if blog.canEdit %}[<my:a href="{{ url_base }}index.php?go={{ appName }}.blog.write&blog_id={{ blog.blog_id }}&pageNo={{ app.request.get('pageNo')|default('1') }}">改</my:a>]{% endif %}
            {% if blog.canDelete %}[<my:a href="{{ url_base }}index.php?go={{ appName }}.blog.delete&blog_id={{ blog.blog_id }}&pageNo={{ app.request.get('pageNo')|default('1') }}">删</my:a>]{% endif %}
            </b><br/>
            {{ blog.blog_content|raw|nl2br }}<br/><br/>
            由 {{ blog.user.username }} 在 {{ blog.commitTime|date('Y-m-d H:i') }} 发表<br/>
            评论数:{{ viewObject.count_comments(blog.blog_id) }}<br/>
        </div>
        {% endfor %}<br/>
        <my:page src='{{ url_base }}index.php?go={{ appName }}.blog.display' /><br/>
        <b><my:a href="{{ url_base }}index.php?go={{ appName }}.blog.write&pageNo={{ app.request.get('pageNo')|default('1') }}">新建博客</my:a></b><br/>
        {% else %}
        无博客，您是第一位!
        {% endif %}
    </div>
{% endblock %}
